'use strict';
exports.main = async (event, context) => {
	console.log(event)
	//event为客户端上传的参数
	const db = uniCloud.database()
	return new Promise((resolve,rejects) => {
		if(event.isOver){
			db.collection('TodoList').doc(event._id).update({
				isOver:false
			}).then((res) =>{
				resolve(res)
			}).catch((err)=>{
				rejects(err)
			})
		}else{
			db.collection('TodoList').doc(event._id).update({
				isOver:true
			}).then((res) =>{
				resolve(res)
			}).catch((err)=>{
				rejects(err)
			})
		}
	})
};
